
#include "TaskSchedulerSettings.h"

#include "Common/Strings.h"

using namespace ttg::services;

//-----------------------------
//--- TaskSchedulerSettings ---
//-----------------------------

std::string TaskSchedulerSettings::serialize()
{
	return getStringName() + "(worker_count=" + ttg::strings::toString(worker_count) + ")";
}

TaskSchedulerSettings TaskSchedulerSettings::deSerialize(const char *value)
{
	TaskSchedulerSettings res;
	ttg::strings::StringSplitter sp;
	sp.setSplitter('=', false);
	sp.setString(value);
	if (sp.getCount() == 2 &&
		sp[0] == std::string("worker_count"))
	{ ttg::strings::isInt(sp[1], res.worker_count); }
	return res;
}
